<ul>
	<?php

		// Get the current page we are on from the GET parameters passed
		$page = get_page_of_params($_SERVER["REQUEST_URI"]);

		// Create an association between link names and their respective pages
		$links = array();
		$links["Home"] = '?p=home';

		// Add the following links if the user is NOT logged in
		if(!isset($_SESSION["loggedIn"])){
			// Begin NOT LoggedIn Navbar Options
			$links["Login"] = '?p=loginform';
			$links["Help"] = '?p=help';
		}
		else {
			// Begin LoggedIn Navbar Options
			$links["Your Room"] = '?p=recentdata';
			$links["Your History"] = '?p=timeforms';
			$links["Your Sensors"] = '?p=sensormanagement';
			$links["Your Account"] = '?p=settings';
		}

		// Go through each link and create html for it
		foreach($links as $name => $link)
		{
			$linkPage = get_page_of_params($link);
			// Does the current page point to this link?
			if($page !== false && $page === $linkPage)
			{
				echo '<li class="current"><a href="'.$link.'">'.$name.'</a></li>';
			}
			// Otherwise don't set link to current
			else
			{
				echo '<li><a href="'.$link.'">'.$name.'</a></li>';
			}
		}
	?>
</ul>
